package objbo.xmlparser.main;

import objbo.xmlparser.view.interfaces.InterFaceMain;
import objbo.xmlparser.view.ui.FileControlUI;
import objbo.xmlparser.view.ui.IParserUI;
import objbo.xmlparser.view.ui.MainUI;
import objbo.xmlparser.view.ui.TabUI;
import objbo.xmlparser.view.ui.XMLTreeUI;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;

public class ParserMain
{
	public static void main(String[] args) 
	{
		new ParserMain();
	}
	
	public ParserMain()
	{
		
		final Point size = new Point(800, 600);
		
		InterFaceMain interFaceMain = null;
		
		Display display = null;
		Shell shell = null;
		
		XMLTreeUI leftUI = null;
		FormData leftUILayoutData = null;
		
		
		
		TabUI upUI = null;
		FormData upUILayoutData = null;
		
		
		
		FileControlUI downUI = null;
		FormData downUILayoutData = null;
		
		Layout layout = null;
		
		try
		{
			interFaceMain = new InterFaceMain();
			
			display = new Display();
			shell = new Shell(display);
			
			layout = new FormLayout();
			shell.setLayout(layout);
			
			
			shell.setText("I'm Window");
			//shell.setSize(size);
			
			
			
//			leftUI = interFaceMain.getUIInterFace().makeTreeUI(shell);
//			
//			leftUILayoutData = new FormData();
//			leftUILayoutData.top = new FormAttachment(0, 5);
//			leftUILayoutData.left = new FormAttachment(0, 5);
//			leftUILayoutData.right = new FormAttachment(50, -5);
//			leftUILayoutData.bottom = new FormAttachment(100,-5);
//			
//			leftUI.setLayoutData(leftUILayoutData);
//			
//			
//			
//			upUI = interFaceMain.getUIInterFace().makeTabUI(shell);
//			
//			upUILayoutData = new FormData();
//			upUILayoutData.top = new FormAttachment(0, 5);
//			upUILayoutData.left = new FormAttachment(leftUI);
//			upUILayoutData.right = new FormAttachment(100, -5);
//			upUILayoutData.bottom = new FormAttachment(80,-5);
//			
//			upUI.setLayoutData(upUILayoutData);
//			
//			
//			downUI = interFaceMain.getUIInterFace().makeFileControlUI(shell);
//			
//			downUILayoutData = new FormData();
//			downUILayoutData.top = new FormAttachment(upUI);
//			downUILayoutData.left = new FormAttachment(leftUI);
//			downUILayoutData.right = new FormAttachment(100, -5);
//			downUILayoutData.bottom = new FormAttachment(100);
//			
//			downUI.setLayoutData(downUILayoutData);
			
			
			new MainUI(shell);
			
			
			
			shell.pack();
			shell.open();

			while(!shell.isDisposed())
			{
				if( !display.readAndDispatch() )
				{
					display.sleep();
				}
			}
			display.dispose();




		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		finally
		{

		}
	}
	
	
}
